<script setup lang="ts">
import {useUserStore} from "@/stores/user";
import {useRouter} from "vue-router";

const userStore = useUserStore();
const router = useRouter();

let goToLogin = () => {
  router.push({
    name: "login",
  });
  userStore.hideLoginDialog()
};
</script>
<template>
  <div style="background-color: white">
    <RouterView/>
    <el-dialog
        v-model="userStore.loginDialogVisible"
        title="警告"
        width="500"
        align-center
    >
      <span>请你先登录再执行操作</span>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="userStore.hideLoginDialog()">
            取消
          </el-button>
          <el-button type="primary" @click="goToLogin">前往登录</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
